 // Created by Xslt generator for Eclipse.
// XSL :  not found (java.io.FileNotFoundException:  (Bad file descriptor))
// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xsl

package com.ba360.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.ba360.portal.common.PortalConstants;

/**
 * LoginForm.java created by EasyStruts - XsltGen. http://easystruts.sf.net
 * created on 04-02-2004
 * 
 * XDoclet definition:
 * 
 * @struts:form name="LoginForm"
 */
public class LoginForm_23Feb09 extends ActionForm {

	// --------------------------------------------------------- Instance
	// Variables

	/** password property */
	private String password;

	/** userName property */
	private String userName;

	// --------------------------------------------------------- Methods

	/*public void reset(ActionMapping mapping, HttpServletRequest request) {
		userName = null;
		password = null;
		System.out.println("Value of action in query string is:"+request.getParameter("action"));
	}*/

	/**
	 * Method validate
	 * 
	 * @param ActionMapping
	 *            mapping
	 * @param HttpServletRequest
	 *            request
	 * @return ActionErrors
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors ae = new ActionErrors();
		//request.getHeader("referer");
		request.getQueryString().valueOf("action");
		System.out.println("Value of action parameter in request query string is:"+request.getQueryString().toString());
		System.out.println("Value of action parameter in request query string is:"+request.getRequestURI().toString());
		
		String action = (String) request.getParameter(PortalConstants.ACTION);
		if (action == null) {
			;//return ae;
		}

		//if (action.equals("Login")) {
			//throw new UnsupportedOperationException("Generated method
			// 'validate(...)' not implemented.");
			if (userName == null || userName.trim().length() == 0) {
				ae.add("UserName", new ActionError("error.username.notvalid"));
				return ae;

			}
			if (password == null || password.trim().length() == 0) {
				ae.add("Password", new ActionError("error.password.notvalid"));
				return ae;
			}
		//}
		return ae;
	}

	/**
	 * Returns the password.
	 * 
	 * @return String
	 */
	public String getPassword() {
		
		return password;
	}

	/**
	 * Set the password.
	 * 
	 * @param password
	 *            The password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * Returns the userName.
	 * 
	 * @return String
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * Set the userName.
	 * 
	 * @param userName
	 *            The userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

}